/*** Replication do file for: 
"Institutional personalism and personalised behaviour: Electoral systems, candidate selection methods, and politicians' campaign strategy" by Or Tuttnauer and Gideon Rahat
*/

* Figure 2

vioplot focus, over(personalism_cat3) over(fm_b) 
ttest focus, by(fm_b) 

oneway focus personalism_cat3 if fm_b==0, tabulate
anova focus personalism_cat3 if fm_b==0
pwcompare personalism_cat3, pv 


oneway focus personalism_cat3 if fm_b==1, tabulate
anova focus personalism_cat3 if fm_b==1
pwcompare personalism_cat3, pv 



** Table 2 **

metobit focus c.condensed_fm i.personalism_cat3  ///
	 || ccs_party_id:, ul(10) ll(0) 
estimates store model1

metobit focus c.condensed_fm i.personalism_cat3  ///
	parl_exp local_exp elec_exp  ///
	 lnavgdm ib13.party_bloc  ///
	 || ccs_party_id:, ul(10) ll(0)
estimates store model2

metobit focus c.condensed_fm##i.personalism_cat3  ///
	parl_exp local_exp elec_exp  ///
	lnavgdm ib13.party_bloc  ///
	 || ccs_party_id:, ul(10) ll(0)
estimates store model3

esttab model1 model2 model3 using "table2.rtf", se aic bic label ///
	replace noomit nobase nogaps star(+ 0.1 * 0.05 ** 0.01 *** 0.001)

** Figure 3 **
margins, dydx(personalism_cat3) at(condensed_fm=(0 (1) 4))
marginsplot, plotopts(lpattern(blank)) /// 
	xlab(-.5 " " 0 "Closed-list" 1 "Ordered-list" 2 "FPTP" 3 "Open-list" 4 "Quasi-list" ///
	4.5 " ", notick)  ///
	yline(0) ciopts(msize(vlarge) lwidth(medthick)) ///
	ytitle("Effect of intraparty personalism on campaign focus") ///
	xtitle("Electoral system") title("") name(focus_ame, replace) ///
	ci1opts(lcolor(purple)) ci2opts(lcolor(orange)) ///
	plot1opts(mcolor(purple) msymbol(O)) ///
	plot2opts(mcolor(orange) msymbol(S)) ///
	legend(position(6) order(1 "Leader-based methods" 2 "Primaries-based methods") col(2))

	
** Robustness Tests **

// Less condensed FM measure
metobit focus c.fm_c i.personalism_cat3  ///
	 || ccs_party_id:, ul(10) ll(0)
estimates store model1_a1

metobit focus fm_c i.personalism_cat3  ///
	parl_exp local_exp elec_exp  ///
	lnavgdm ib13.party_bloc ///
	 || ccs_party_id:, ul(10) ll(0)
estimates store model2_a1

metobit focus c.fm_c##i.personalism_cat3  ///
	parl_exp local_exp elec_exp  ///
	lnavgdm ib13.party_bloc ///
	 || ccs_party_id:, ul(10) ll(0)
estimates store model3_a1

// Binary FM measure
metobit focus fm_b i.personalism_cat3  ///
	 || ccs_party_id:, ul(10) ll(0)
estimates store model4_a1

metobit focus fm_b i.personalism_cat3  ///
	parl_exp local_exp elec_exp  ///
	lnavgdm ib13.party_bloc ///
	 || ccs_party_id:, ul(10) ll(0)
estimates store model5_a1

metobit focus fm_b##i.personalism_cat3  ///
	parl_exp local_exp elec_exp  ///
	lnavgdm ib13.party_bloc ///
	 || ccs_party_id:, ul(10) ll(0)
estimates store model6_a1

// Added country level
metobit focus c.condensed_fm i.personalism_cat3  ///
	|| country_id: || ccs_party_id:, ul(10) ll(0) 
estimates store model1_a2

metobit focus c.condensed_fm i.personalism_cat3  ///
	parl_exp local_exp elec_exp  ///
	lnavgdm ib13.party_bloc ///
	 || country_id: || ccs_party_id:, ul(10) ll(0)
estimates store model2_a2

metobit focus c.condensed_fm##i.personalism_cat3  ///
	parl_exp local_exp elec_exp  ///
	lnavgdm ib13.party_bloc ///
	|| country_id: || ccs_party_id:, ul(10) ll(0)
estimates store model3_a2

// Mixed instead of METobit
mixed focus condensed i.personalism_cat3  ///
	 || ccs_party_id:
estimates store model1_a3

mixed focus condensed i.personalism_cat3  ///
	parl_exp local_exp elec_exp  ///
	lnavgdm ib13.party_bloc ///
	 || ccs_party_id:
estimates store model2_a3

mixed focus c.condensed##i.personalism_cat3  ///
	parl_exp local_exp elec_exp  ///
	lnavgdm ib13.party_bloc ///
	 || ccs_party_id:
estimates store model3_a3

// Added controls
metobit focus c.condensed_fm##i.personalism_cat3  ///
	parl_exp local_exp elec_exp  ///
	lnavgdm ib13.party_bloc ///
	gender || ccs_party_id:, ul(10) ll(0)
estimates store model1_a4

metobit focus c.condensed_fm##i.personalism_cat3  ///
	parl_exp local_exp elec_exp  ///
	lnavgdm ib13.party_bloc ///
	candidate_age || ccs_party_id:, ul(10) ll(0)
estimates store model2_a4

metobit focus c.condensed_fm##i.personalism_cat3  ///
	parl_exp local_exp elec_exp  ///
	lnavgdm ib13.party_bloc ///
	i.education  || ccs_party_id:, ul(10) ll(0)
estimates store model3_a4

metobit focus c.condensed_fm##i.personalism_cat3  ///
	parl_exp local_exp elec_exp  ///
	lnavgdm ib13.party_bloc ///
	migrant   || ccs_party_id:, ul(10) ll(0)
estimates store model4_a4

// Another question - personal characteristics
metobit emphasis_c c.condensed_fm i.personalism_cat3  ///
	parl_exp local_exp elec_exp  ///
	lnavgdm ib13.party_bloc ///
	 || ccs_party_id:, ul(10) ll(0)
estimates store model1_a5

metobit emphasis_c c.condensed_fm##i.personalism_cat3  ///
	parl_exp local_exp elec_exp  ///
	lnavgdm ib13.party_bloc ///
	 || ccs_party_id:, ul(10) ll(0)
estimates store model2_a5
margins, dydx(personalism_cat3) at(condensed_fm=(0 (1) 4))
marginsplot, plotopts(lpattern(blank)) name(a5_char, replace) ///
	xlab(-.5 " " 0 "Closed-list" 1 "Ordered-list" 2 "FPTP" 3 "Open-list" 4 "Quasi-list" ///
	4.5 " ", notick) ///
	yline(0) ciopts(msize(vlarge)) ///
	ytitle("Effect of intraparty personalism on campaign emphasis") ///
	xtitle("Electoral system") title("")

// Another question - personal issues
metobit emphasis_i c.condensed_fm i.personalism_cat3  ///
	parl_exp local_exp elec_exp  ///
	lnavgdm ib13.party_bloc ///
	 || ccs_party_id:, ul(10) ll(0)
estimates store model3_a5

metobit emphasis_i c.condensed_fm##i.personalism_cat3  ///
	parl_exp local_exp elec_exp  ///
	lnavgdm ib13.party_bloc ///
	 || ccs_party_id:, ul(10) ll(0)
estimates store model4_a5
margins, dydx(personalism_cat3) at(condensed_fm=(0 (1) 4))
marginsplot, plotopts(lpattern(blank)) name(a5_iss, replace) ///
	xlab(-.5 " " 0 "Closed-list" 1 "Ordered-list" 2 "FPTP" 3 "Open-list" 4 "Quasi-list" ///
	4.5 " ", notick) ///
	yline(0) ciopts(msize(vlarge)) ///
	ytitle("Effect of intraparty personalism on campaign emphasis") ///
	xtitle("Electoral system") title("")

//  average emphasis
metobit combined_emphasis c.condensed_fm i.personalism_cat3  ///
	parl_exp local_exp elec_exp  ///
	lnavgdm ib13.party_bloc ///
	 || ccs_party_id:, ul(10) ll(0)
estimates store model5_a5

metobit combined_emphasis c.condensed_fm##i.personalism_cat3  ///
	parl_exp local_exp elec_exp  ///
	lnavgdm ib13.party_bloc ///
	 || ccs_party_id:, ul(10) ll(0)

estimates store model6_a5
margins, dydx(personalism_cat3) at(condensed_fm=(0 (1) 4))
marginsplot, plotopts(lpattern(blank)) name(a5_avg, replace) ///
	xlab(-.5 " " 0 "Closed-list" 1 "Ordered-list" 2 "FPTP" 3 "Open-list" 4 "Quasi-list" ///
	4.5 " ", notick) ///
	yline(0) ciopts(msize(vlarge)) ///
	ytitle("Effect of intraparty personalism on campaign emphasis") ///
	xtitle("Electoral system") title("")

// factored emphasis
metobit factored_emphasis c.condensed_fm i.personalism_cat3  ///
	parl_exp local_exp elec_exp  ///
	lnavgdm ib13.party_bloc ///
	 || ccs_party_id:, ul(10) ll(0)
estimates store model1_a5b

metobit factored_emphasis c.condensed_fm##i.personalism_cat3  ///
	parl_exp local_exp elec_exp  ///
	lnavgdm ib13.party_bloc ///
	 || ccs_party_id:, ul(10) ll(0)
estimates store model2_a5b
margins, dydx(personalism_cat3) at(condensed_fm=(0 (1) 4))
marginsplot, plotopts(lpattern(blank)) name(a5_facemph, replace) ///
	xlab(-.5 " " 0 "Closed-list" 1 "Ordered-list" 2 "FPTP" 3 "Open-list" 4 "Quasi-list" ///
	4.5 " ", notick) ///
	yline(0) ciopts(msize(vlarge)) ///
	ytitle("Effect of intraparty personalism on campaign emphasis") ///
	xtitle("Electoral system") title("")

// A factored three-item measure
metobit factored_focus condensed_fm i.personalism_cat3  ///
	parl_exp local_exp elec_exp  ///
	lnavgdm ib13.party_bloc ///
	 || ccs_party_id:, ul(10) ll(0)
estimates store model3_a5b

metobit factored_focus c.condensed_fm##i.personalism_cat3  ///
	parl_exp local_exp elec_exp  ///
	lnavgdm ib13.party_bloc ///
	 || ccs_party_id:, ul(10) ll(0)
estimates store model4_a5b
margins, dydx(personalism_cat3) at(condensed_fm=(0 (1) 4))
marginsplot, plotopts(lpattern(blank)) name(a5_facfoc, replace) ///
	xlab(-.5 " " 0 "Closed-list" 1 "Ordered-list" 2 "FPTP" 3 "Open-list" 4 "Quasi-list" ///
	4.5 " ", notick) ///
	yline(0) ciopts(msize(vlarge)) ///
	ytitle("Effect of intraparty personalism on campaign emphasis") ///
	xtitle("Electoral system") title("")

// Jacknife
forvalues i = 1/20 {
	metobit focus c.condensed_fm##i.personalism_cat3  ///
	parl_exp local_exp elec_exp  ///
	lnavgdm ib13.party_bloc ///
	if country_id!=`i' || ccs_party_id:, ul(10) ll(0)
	estimates store model`i'_a6
}

esttab model1_a1 model2_a1 model3_a1 model4_a1 model5_a1 model6_a1 using ///
	"table_a1.rtf", se aic bic label ///
	replace noomit nobase nogaps star(+ 0.1 * 0.05 ** 0.01 *** 0.001)

esttab model1_a2 model2_a2 model3_a2 using ///
	"table_a2.rtf", se aic bic label ///
	replace noomit nobase nogaps star(+ 0.1 * 0.05 ** 0.01 *** 0.001)

esttab model1_a3 model2_a3 model3_a3 using ///
	"table_a3.rtf", se aic bic label ///
	replace noomit nobase nogaps star(+ 0.1 * 0.05 ** 0.01 *** 0.001)

esttab model1_a4 model2_a4 model3_a4 model4_a4 using ///
	"table_a4.rtf", se aic bic label ///
	replace noomit nobase nogaps star(+ 0.1 * 0.05 ** 0.01 *** 0.001)

esttab model1_a5 model2_a5 model3_a5 model4_a5 model5_a5 model6_a5 using ///
	"table_a5.rtf", se aic bic label ///
	replace noomit nobase nogaps star(+ 0.1 * 0.05 ** 0.01 *** 0.001)

esttab model1_a5b model2_a5b model3_a5b model4_a5b using ///
	"table_a5b.rtf", se aic bic label ///
	replace noomit nobase nogaps star(+ 0.1 * 0.05 ** 0.01 *** 0.001)

esttab model1_a6 model2_a6 model3_a6 model4_a6 model7_a6 model8_a6 ///
	model9_a6 model14_a6 model15_a6 model6_a6 model17_a6 model18_a6 ///
	model19_a6 model20_a6 using "table_a6.rtf", se aic bic label ///
	replace noomit nobase nogaps star(+ 0.1 * 0.05 ** 0.01 *** 0.001)

